package com.edu.medicalpro.mvp.view;

import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.edu.medicalpro.R;
import com.edu.medicalpro.base.BaseFragment;
import com.edu.medicalpro.bean.DoctorData;
import com.edu.medicalpro.bean.PatientResult;
import com.edu.medicalpro.bean.User;
import com.edu.medicalpro.bean.Doctor1;
import com.edu.medicalpro.mvp.HomeContrace;
import com.edu.medicalpro.mvp.presenter.HomePresenter;


public class HomeFragement  extends BaseFragment implements HomeContrace.IView{

    private TextView viewText;
    @Override
    protected void initView(View rootView) {
        viewText = rootView.findViewById(R.id.first_tv);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_home;
    }

    @Override
    protected void initData() {
//        new HomePresenter(this).login("wuyb520","123123");
    }

    @Override
    public void loginResult(User user) {
        viewText.setText(user.getData().toString());
       Doctor1 patient = new Doctor1();
        patient.setAccId(9);
        patient.setBirthday("1999-04-01");
        patient.setCardCode("500225199804016235");
        patient.setConcat("李三");
        patient.setHospId(5);
        patient.setName("wangwu");
        patient.setPhone("12546982578");
        patient.setRelation("5");
        patient.setSex("1");
        patient.setTel("12546982578");
        patient.setVisitCad("1478592369");
        new HomePresenter(this).addPatient(patient);
    }

    @Override
    public void LoginError(Throwable throwable) {

    }

    @Override
    public void Result(PatientResult user) {
        int code = user.getCode();
        if(code==200){
            Toast.makeText(getContext(),"ok",Toast.LENGTH_SHORT).show();
        }

    }

    @Override
    public void DoctorResult(DoctorData doctor) {

    }
}
